<template>
  <div class="success-wrap">
    <a-result
      status="success"
      :title="$t('stepForm.success.title')"
      :subtitle="$t('stepForm.success.subTitle')"
    />
    <a-space :size="16">


      <a-popconfirm content="确定要进行代码生成吗?" @ok="genCode">
        <a-button  type="text" size="small" key="view">
          代码生成
        </a-button>
      </a-popconfirm>


      <a-button key="again" type="secondary" @click="create">
         再次创建
      </a-button>


      <a-button key="again" type="secondary" @click="back">
         返回列表
      </a-button>

    </a-space>
    <div class="details-wrapper">
      <a-typography-title :heading="6" style="margin-top: 0">
        代码生成说明
      </a-typography-title>
      <a-typography-paragraph style="margin-bottom: 0">
       代码生成本地有代码覆盖的风险,如有重要代码没有提交清先备份后在生成
        <a-link href="link">{{ $t('stepForm.button.view') }}</a-link>
      </a-typography-paragraph>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import {useRouter} from "vue-router";
  import {createCode} from "@/api/dev";

  const emits = defineEmits(['changeStep']);
  const router = useRouter();
  const row = defineProps(['rowId'])

  const oneMore = () => {
    emits('changeStep', 1);
  };

  const genCode = async () => {
    await createCode(row.rowId)
  }

  const back = () => {
      router.push({ name: 'onlineHome' })
  }

  const create = () => {
    router.push({ name: 'gen', query: { id: null} })
  }



</script>

<style scoped lang="less">
  .success-wrap {
    text-align: center;
  }
  :deep(.arco-result) {
    padding-top: 0;
  }
  .details-wrapper {
    width: 895px;
    margin-top: 54px;
    padding: 20px;
    text-align: left;
    background-color: var(--color-fill-2);
  }
</style>
